#############################################

	Calibrating Autonomy:
	How Bureaucratic Autonomy Influences Government Quality in Brazil

	Katherine Bersch & Francis Fukuyama 

#############################################

This file describes the contents of: 
Bersch, Katherine; Fukuyama, Francis, 2024, "Replication Data for: Calibrating Autonomy: How Bureaucratic Autonomy Influences Government Quality in Brazil", https://doi.org/10.7910/DVN/2VIGEC. 

All data should be stored in a subdirectory named "data" inside your working directory. 

The results of sessionInfo() are at the bottom of this readme.txt. Scripts 1 and 2 run with SESSION INFO A and Scripts 3 and 4 run with See SESSION INFO B below. 

These script files prepare the data for analysis. The original survey and administrative data are not included to protect the privacy of public servants. 


1. R_code_to_perform_analyses.R - This script files reproduces the figures and tables in the main text (Note: see SESSION INFO A below to recreate correct plots). 
2. R_code_SM_MLM.R - This script files reproduces the figures and tables in the SM Appendix B and MLM models (see SESSION INFO A below)

See SESSION INFO B below 
3. block_bootstrap.R - This script reproduces figures and tables in SM Appendix C (see SESSION INFO B below).
4. linear_interaction_diagnostic_plots.R - This script reproduces figures and tables in the SM Appendix D and Appendix E (see SESSION INFO B below).


The following packages are necessary to reproduce the figures and tables: 
#############
library(dplyr)
library(ggplot2)
library(interplot)
library(grid)
library(gridExtra)
library(stargazer)
library(broom)
library(geepack)
library(lme4)
library(lmerTest)
library(Hmisc)
library(useful)
library(BBmisc)
library(magrittr)
library(MESS)
library(sjPlot)
library(ggeffects)
library(effects)
library(psych)
library(apaTables)


The data files are: 

data/CalibratingAutonomy.csv
data/SM_CalibratingAutonomy.csv



#############
#############
SESSION INFO A
Below are the specific versions of R and the various packages used for script files: 1. R_code_to_perform_analyses.R and 2. R_code_SM_MLM.R . 
#############
#############
> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux 8.9 (Ootpa)

Matrix products: default
BLAS/LAPACK: /opt/pub/eb/apps/cascadelake/OpenBLAS/0.3.12-GCC-10.2.0/lib/libopenblas_skylakexp-r0.3.12.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8       
 [4] LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] readr_1.4.0      corrplot_0.84    apsrtable_0.8-8  apaTables_2.0.5  psych_2.1.3     
 [6] effects_4.2-0    carData_3.0-4    ggeffects_0.15.1 sjPlot_2.8.4     MESS_0.5.7      
[11] magrittr_2.0.1   BBmisc_1.11      useful_1.2.6     Hmisc_4.5-0      Formula_1.2-4   
[16] survival_3.2-10  lattice_0.20-41  lmerTest_3.1-3   geepack_1.3-2    broom_0.7.6     
[21] stargazer_5.2.2  gridExtra_2.3    interplot_0.2.2  arm_1.11-2       lme4_1.1-26     
[26] Matrix_1.3-2     MASS_7.3-53.1    abind_1.4-5      ggplot2_3.3.3    dplyr_1.0.5     

loaded via a namespace (and not attached):
 [1] TH.data_1.0-10      minqa_1.2.4         colorspace_2.0-0    ellipsis_0.3.1     
 [5] sjlabelled_1.1.6    estimability_1.3    ggstance_0.3.4      htmlTable_2.1.0    
 [9] parameters_0.8.2    base64enc_0.1-3     rstudioapi_0.13     farver_2.1.0       
[13] fansi_0.4.2         mvtnorm_1.1-1       codetools_0.2-18    splines_4.0.5      
[17] mnormt_2.0.2        knitr_1.31          sjmisc_2.8.5        polyclip_1.10-0    
[21] nloptr_1.2.2.2      interactionTest_1.2 cluster_2.1.1       png_0.1-7          
[25] ggforce_0.3.3       effectsize_0.3.2    compiler_4.0.5      sjstats_0.18.0     
[29] emmeans_1.5.0       backports_1.2.1     assertthat_0.2.1    lazyeval_0.2.2     
[33] survey_4.0          cli_2.4.0           tweenr_1.0.2        htmltools_0.5.1.1  
[37] tools_4.0.5         coda_0.19-4         gtable_0.3.0        glue_1.4.2         
[41] Rcpp_1.0.6          vctrs_0.3.7         debugme_1.1.0       nlme_3.1-152       
[45] insight_0.9.1       xfun_0.22           stringr_1.4.0       lifecycle_1.0.0    
[49] geeM_0.10.1         mosaicCore_0.6.0    statmod_1.4.35      zoo_1.8-9          
[53] scales_1.1.1        hms_1.0.0           parallel_4.0.5      sandwich_3.0-0     
[57] RColorBrewer_1.1-2  rpart_4.1-15        latticeExtra_0.6-29 stringi_1.5.3      
[61] bayestestR_0.7.2    checkmate_2.0.0     boot_1.3-27         rlang_0.4.10       
[65] pkgconfig_2.0.3     purrr_0.3.4         htmlwidgets_1.5.3   tidyselect_1.1.0   
[69] ggformula_0.9.4     plyr_1.8.6          R6_2.5.0            generics_0.1.0     
[73] multcomp_1.4-16     DBI_1.1.1           pillar_1.5.1        foreign_0.8-81     
[77] withr_2.4.1         nnet_7.3-15         tibble_3.1.0        performance_0.4.8  
[81] modelr_0.1.8        crayon_1.4.1        utf8_1.2.1          tmvnsim_1.0-2      
[85] jpeg_0.1-8.1        data.table_1.14.0   digest_0.6.27       xtable_1.8-4       
[89] tidyr_1.1.3         numDeriv_2016.8-1.1 munsell_0.5.0       mitools_2.4      

  


#############
#############
SESSION INFO B
Below are the specific versions of R and the various packages used for script files: 3. block_bootstrap.R and 4. linear_interaction_diagnostic_plots.R . 
#############
#############

sessionInfo()R version 4.3.2 (2023-10-31)Platform: aarch64-apple-darwin20 (64-bit)Running under: macOS Sonoma 14.3.1Matrix products: defaultBLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0locale:[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8time zone: America/New_Yorktzcode source: internalattached base packages:[1] stats     graphics  grDevices utils     datasets  methods   base     other attached packages:[1] interflex_1.2.6    readr_2.1.4        huxtable_5.5.2     multiwayvcov_1.2.3 lmerTest_3.1-3    [6] lme4_1.1-34        Matrix_1.6-1.1    loaded via a namespace (and not attached):  [1] pROC_1.18.4             gridExtra_2.3           sandwich_3.0-2          rlang_1.1.1              [5] magrittr_2.0.3          compiler_4.3.2          mgcv_1.9-0              systemfonts_1.0.4        [9] vctrs_0.6.3             stringr_1.5.0           httpcode_0.3.0          pkgconfig_2.0.3         [13] crayon_1.5.2            fastmap_1.1.1           ellipsis_0.3.2          labeling_0.4.2          [17] utf8_1.2.3              promises_1.2.1          rmarkdown_2.25          tzdb_0.4.0              [21] nloptr_2.0.3            ragg_1.2.5              bit_4.0.5               xfun_0.40               [25] cachem_1.0.8            jsonlite_1.8.7          later_1.3.1             uuid_1.1-0              [29] parallel_4.3.2          R6_2.5.1                stringi_1.7.12          RColorBrewer_1.1-3      [33] car_3.1-2               parallelly_1.36.0       boot_1.3-28.1           lmtest_0.9-40           [37] numDeriv_2016.8-1.1     Rcpp_1.0.11             assertthat_0.2.1        iterators_1.0.14        [41] knitr_1.43              zoo_1.8-12              Lmoments_1.3-1          httpuv_1.6.11           [45] splines_4.3.2           tidyselect_1.2.0        abind_1.4-5             rstudioapi_0.15.0       [49] yaml_2.3.7              doParallel_1.0.17       codetools_0.2-19        curl_5.0.2              [53] listenv_0.9.0           plyr_1.8.8              lattice_0.21-9          tibble_3.2.1            [57] shiny_1.7.5             withr_2.5.0             flextable_0.9.3         askpass_1.1             [61] evaluate_0.21           survival_3.5-7          gridGraphics_0.5-1      future_1.33.0           [65] zip_2.3.0               xml2_1.3.5              pillar_1.9.0            carData_3.0-5           [69] foreach_1.5.2           generics_0.1.3          vroom_1.6.3             AER_1.2-10              [73] hms_1.1.3               ggplot2_3.4.3           munsell_0.5.0           scales_1.2.1            [77] minqa_1.2.5             globals_0.16.2          xtable_1.8-4            glue_1.6.2              [81] gdtools_0.3.3           tools_4.3.2             gfonts_0.2.0            lfe_2.9-0               [85] data.table_1.14.8       pcse_1.9.1.1            ModelMetrics_1.2.2.2    mvtnorm_1.2-2           [89] grid_4.3.2              colorspace_2.1-0        nlme_3.1-163            Formula_1.2-5           [93] cli_3.6.1               textshaping_0.3.6       officer_0.6.2           fontBitstreamVera_0.1.1 [97] fansi_1.0.4             dplyr_1.1.2             gtable_0.3.3            yulab.utils_0.0.7      [101] digest_0.6.33           fontquiver_0.2.1        ggplotify_0.1.2         crul_1.4.0             [105] farver_2.1.1            memoise_2.0.1           htmltools_0.5.6         lifecycle_1.0.3        [109] mime_0.12               fontLiberation_0.1.0    openssl_2.1.0           bit64_4.0.5            [113] MASS_7.3-60            